package com.example.user.myqq;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

/**
 * Created by User on 2017/7/18.
 */

public class DengLuAdpter extends BaseAdapter{
    Context context;
    List<Contentlist> list;

    public DengLuAdpter(Context context, List<Contentlist> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return i;
    }
    TestHoter testHoter;
    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if (view==null){
            testHoter = new TestHoter();
            view=View.inflate(context,R.layout.listview,null);
            testHoter.textView1 = view.findViewById(R.id.text);
            testHoter.textView2 = view.findViewById(R.id.text2);
            view.setTag(testHoter);
        }else {
            testHoter = (TestHoter) view.getTag();
        }
            testHoter.textView1.setText(list.get(i).getTitle());
            testHoter.textView2.setText(list.get(i).getText());
        return view;
    }
    class TestHoter{
        TextView textView1;
        TextView textView2;
    }
}
